home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="utf-8"?> <html><head><title>Abs Function [Runtime]</title><meta name="filename" content="text/sbasic/common/03080601"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css"> p.P1{ } span.T1{ font-weight:bold;} </style></head><body> <help:to-be-embedded Eid="abs" xmlns:help="http://openoffice.org/2000/help"> <p class="Head1"><help:link Id="66382">Abs Function [Runtime]</help:link></p> <p class="Paragraph">Returns the absolute value of a numeric expression.</p> </help:to-be-embedded> <p class="Paragraph"><span class="T1">Syntax</span>:</p> <p class="Paragraph">Abs (Number) <help:key-word value="Abs" tag="kw66382_1" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="Paragraph"><span class="T1">Return value</span>:</p> <p class="Paragraph">Double</p> <p class="Paragraph"><span class="T1">Parameter</span>:</p> <p class="Paragraph">Number: Any numeric expression for which to return the absolute value. Any positive number, including O, will be returned in the original; any negative number will be converted to a positive number.</p> <p class="Paragraph">The following example uses the Absfunction to calculate the difference between two values. It doesnt matter which of the values you enter first; the <span class="T1">Abs</span> function corrects possible negative results.</p> <p class="Paragraph"><span class="T1">Example:</span></p> <p class="PropText">Sub ExampleDifference</p> <p class="PropText">Dim siW1 As Single</p> <p class="PropText">Dim siW2 As Single</p> <p class="PropText">siW1 = Int(InputBox$ ("Please enter the first amount","Value input"))</p> <p class="PropText">siW2 = Int(InputBox$ ("Please enter the second amount","Value input"))</p> <p class="PropText">Print "The difference is "; Abs(siW1 - siW2)</p> <p class="PropText">End Sub</p> </body></html>